package com.azdebugit.redisThreadLocal.test;

/**
 * @Author: itdebug
 * @version:: design_pattern_and_otherutils
 * @description:
 * @create: 2021/12/19 0:51.
 */
public class ThreadUtils<T> {

    private static final ThreadLocal<String> tokenHolder = new ThreadLocal<>();

    private static final ThreadLocal<UmsMember> userHolder = new ThreadLocal<>();

    public static void setToken(String token){
        tokenHolder.set(token);
    }

    public static String getToken(){
        return tokenHolder.get();
    }

    public static void setUserHolder(UmsMember user){
        userHolder.set(user);
    }

    public static UmsMember getUserHolder(){
        return userHolder.get();
    }

    public static void remove(){
        tokenHolder.remove();
        userHolder.remove();
    }

}